<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/common/taglibs.jsp" %>
<script type="text/javascript" src="${ctx }/static/swfupload/swfupload.js"></script>
<script type="text/javascript" src="${ctx }/static/swfupload/swfupload.queue.js"></script>
<script type="text/javascript" src="${ctx }/static/swfupload/swfupload.cookies.js"></script>
<script type="text/javascript" src="${ctx }/static/swfupload/handlers.js"></script>
<div class="pageHeader">
	<form id="form1" action="" method="post" enctype="multipart/form-data">
		<div class="searchBar">
			<table class="searchContent">
				<tr>	
					<td align="right"><span id="spanButtonPlaceholder"></span></td>
					<td align="right"><a id="upload" href="#" onclick="upStart()">上传</a></td>
					<td align="right"><a href="#" id="btnCancelQueue" onclick="cancelUpload();">取消</a></td>
				</tr>
			</table>
		</div>
	</form>
</div>
<div class="pageContent">
	<div id="divFileProgressContainer"></div>
	<table class="table" width="100%" layoutH="112" style="width: 100%">
		<thead>
			<tr>
				<th width="10%"><input type="checkbox" group="ids" class="checkboxCtrl"></th>
				<th width="40%">文件名</th>
				<th width="20%">文件类型</th>
				<th width="20%">文件大小</th>
				<th width="10%">状态</th>
			</tr>
		</thead>
		<tbody id="infoTable">
		</tbody>
	</table>
</div>
<script type="text/javascript">
var swfu;
$(document).ready(function(){
	var settings = {
			
		flash_url : "${ctx}/static/swfupload/swfupload.swf",
		upload_url : "${ctx}/attachment/swfupload/upload;jsessionid=<%=request.getSession().getId()%>",
		//bType区分业务模块
		post_params : {
			"bType":"user"
		},
		file_size_limit : "5 MB",
		file_types : "*.zip;*.rar;*.png;*.doc;*.docx;*.ppt;*.pptx;*.txt",
		file_types_description : "All Files",
		file_upload_limit : 100,
		file_queue_limit : 0,
		file_post_name : "attachment",
		custom_settings : {
			progressTarget :"divFileProgressContainer",
			cancelButtonId :"btnCancelQueue"
		},
		// Button settings
		button_width : "65",
		button_height : "29",
		//button_placeholder_id : "buttonPlaceHolder",
		
		button_image_url : "${ctx}/static/images/SmallSpyGlassWithTransperancy_17x18.png",
		button_placeholder_id : "spanButtonPlaceholder",
		button_width: 200,
		button_height: 18,
		button_text : '<span class="button">选择文件 <span class="buttonSmall">(5 MB Max)</span></span>',
		button_text_style : '.button { font-family: Helvetica, Arial, sans-serif; font-size: 12pt; } .buttonSmall { font-size: 10pt; }',
		button_text_top_padding: 0,
		button_text_left_padding: 18,
		button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
		button_cursor: SWFUpload.CURSOR.HAND,
		// The event handler functions are defined in handlers.js
		file_queued_handler : fileQueued,
		file_queue_error_handler : fileQueueError,
		file_dialog_complete_handler : function() {
		},
		file_dialog_complete_handler : fileDialogComplete,//选择好文件后提交
		upload_progress_handler : uploadProgress,
		upload_error_handler : uploadError,
		upload_success_handler : uploadSuccess,
		upload_complete_handler : uploadComplete,
		debug :false

	};
	
	swfu = new SWFUpload(settings);
});

function upStart() {
	// swfu.addPostParam("upload_",document.getElementById("upload_").value);
	//alert("空间不足，关闭上传功能。")
	swfu.startUpload();
}

</script>
